using System;
using System.Collections.Generic;
using System.Text;

namespace TTTView
{
    public class Box
    {
        private int row;
        private int col;

        public Box(int row, int col)
        {
            this.row = row;
            this.col = col;
        }

        public Box(Box cell)
        {
            row = cell.Row;
            col = cell.Col;
        }

        public Box(string s)
        {
            string letter = s.ToUpper().Substring(0, 1);
            char c = char.Parse(letter);
            col = (c - 64);
            row = int.Parse(s.Substring(1, 1));
        }

        public int Row
        {
            get { return row; }
        }

        public int Col
        {
            get { return col; }
        }
       
        public override string ToString()
        {
            char c = (char)(col + 64);

            string s = c.ToString();

            s += row.ToString();

            return s;
        }

        public override bool Equals(object o)
        {
            if (o is Box)
            {
                Box c = (Box)o;

                return (c.row == row && c.col == col);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
